package scoutobahn.highway;

import scoutobahn.xml.OsmNode;
/**
 * DistanceCalculator implementation using the GeoPos class.
 * @author mark
 *
 */
public class GeoDistanceCalculator implements DistanceCalculator {
    /**
     * Returns the distance between the two given OsmNodes in m.
     * @param node1 The first node
     * @param node2 The second node
     * @return The distance in m
     */
    @Override
    public double getDistance(final OsmNode node1,
            final OsmNode node2) {
        return GeoPos.getDistance(node1.getLatitude(), node1.getLongitude(),
                node2.getLatitude(), node2.getLongitude()) * 1000;
    }

}
